package com.example.administrator.viewpager;

import android.content.Context;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.module.LoadMoreModule;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.example.administrator.myfragment.R;

public class ArticleListAdapter extends BaseQuickAdapter<Article, BaseViewHolder> implements LoadMoreModule {

    Context context;

    public ArticleListAdapter(Context context) {
        super(R.layout.item_article2);
        this.context = context;
    }


    @Override
    protected void convert(BaseViewHolder holder, Article article) {

        holder.setText(R.id.tv_title, article.getTitle());
        holder.setText(R.id.tv_author, article.getAuthor());
        holder.setText(R.id.tv_time, article.getNiceDate());
        holder.setText(R.id.tv_title, article.getTitle());
        holder.setText(R.id.tv_tag, "tag");

//        holder.addOnClickListener(R.id.llItem);//旧版本增加这个，可以在页面进行点击事件
        addChildClickViewIds(R.id.llItem, R.id.ll_label);

//        addChildClickViewIds(R.id.llItem,R.id.tv_tag);
//        holder.getView(R.id.tv_title).setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View view) {
//                AppToastUtils.show("title");
//            }
//        });
    }
}
